package cn.wolfcode.web.exception;

import cn.wolfcode.domain.Result;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;



@RestControllerAdvice // 统一异常处理的类
public class ExceptionHandling {
    @ExceptionHandler//指定能够处理的异常
    public Result ex(Exception e){
        e.printStackTrace();
        return Result.error("对不起,操作失败,请联系管理员");
    }
    @ExceptionHandler(DataException.class)
    public Result ex(DataException e){
        return Result.error(e.getMessage());
    }




}
